package org.springcloud.wisdom.springcloud_03_freshman.student.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springcloud.wisdom.springcloud_03_freshman.index.login.entity.Freshman;

@Mapper
public interface FreshmanDao {
    //根据sid查找记录
    @Select("select * from freshman where adsno=#{adsno}")
    public Freshman getFreshmanBySid(String adsno);
    //根据sid更新 地址 邮箱 手机号
    @Update("<script>" +
            "update freshman" +
            "        <set>" +
            "            <if test=\"null!= address\">" +
            "                address =#{address}," +
            "            </if>" +
            "            <if test=\"null!= email\">" +
            "                email =#{email}," +
            "            </if>" +
            "            <if test=\"null!= phone\">" +
            "                phone =#{phone}," +
            "            </if>" +
            "        </set>" +
            "        where sid =#{sid}" +
            "</script>")
    public int UpdateFreshmanBySid(Freshman freshman);

}
